﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace HisoftSmart.Client.AutomationClient.Helpers
{
    [Flags]
    public enum AutomationIdentification
    {
        TryAutomationName = 0x01,
        TryElementName = 0x02,
        TryDisplayedText = 0x04,
        TryEverything = TryAutomationName | TryElementName | TryDisplayedText
    }

    public class AutomationIdentifier
    {
        public string AutomationID { get; set; }
        public string AutomationName { get; set; }
        public string ElementName { get; set; }
        public string DisplayedText { get; set; }

        public AutomationIdentifier()
        {
        }

        public AutomationIdentifier(string text, AutomationIdentification automationIdentification)
        {
            Fill(text, automationIdentification);
        }

        public void Fill(string text, AutomationIdentification automationIdentification)
        {
            AutomationName =
                Enum.GetName(typeof(AutomationIdentification), automationIdentification).Contains("TryAutomationName")
                    ? text
                    : null;

            ElementName =
                Enum.GetName(typeof(AutomationIdentification), automationIdentification).Contains("TryElementName")
                    ? text
                    : null;

            DisplayedText =
                Enum.GetName(typeof(AutomationIdentification), automationIdentification).Contains("TryDisplayedText")
                    ? text
                    : null;
        }
    }
}
